package leetcode.weekly.week331;

import leetcode.helper.H;

public class Solution4Test extends H {

	public void debug4(Solution4 so) {
		H.compare(8, so.minCost(H.str2array3("[4,4,4,4,3]"), H.str2array3("[5,5,5,5,3]")));
		H.compare(837, so.minCost(H.str2array3("[530,1920,2529,2317,1969,2317,1095,2249,2858,2636,3772,53,3106,2638,1267,1926,2882,515,3772,1969,3454,2446,656,2621,1365,1743,3557,1656,3447,446,1098,1446,467,2636,1088,1098,2882,1088,1326,644,3873,3843,3926,1920,2464,2088,205,1200,1267,272,925,925,2172,2491,3168,644,1452,573,1948,3926,205,126,3447]"), H.str2array3("[3350,1104,2004,1577,1365,2088,2249,1948,2621,750,31,2004,1749,3365,3350,3843,3365,1656,3168,3106,2820,3557,1095,2446,573,2464,2172,1326,2712,467,1104,1446,1577,53,2492,2638,1200,2997,3454,2492,1926,1452,2712,446,2997,2820,750,2529,3847,656,272,3873,530,1749,1743,251,3847,31,251,515,2858,126,2491]")));
		H.compare(168, so.minCost(H.str2array3("[183,259,304,201,128,68,289,346,257,259,300,167,167,289,33,304,382,21,183,252]"), H.str2array3("[97,128,169,21,382,169,201,68,365,183,346,97,300,257,56,183,252,365,33,56]")));
		H.compare(1, so.minCost(H.str2array3("[4,2,2,2]"), H.str2array3("[1,4,1,2]")));
		H.compare(48, so.minCost(H.str2array3("[84,80,43,8,80,88,43,14,100,88]"), H.str2array3("[32,32,42,68,68,100,42,84,14,8]")));
		H.compare(1, so.minCost(H.str2array3("[4,2,2,2]"), H.str2array3("[1,4,1,2]")));
		H.compare(228799, so.minCost(H.str2array3("[274132,310719,403386,5618,180012,56555,403464,307663,407494,215669,238964,480293,163971,469785,104596,529503,247697,152482,206623,91782,98960,135620,58952,310291,335004,469324,49266,254749,499661,189804,110069,480401,69526,480083,443693,263816,552229,237959,49088,438879,34624,358553,203769,579564,74486,271167,523869,364542,315242,433816,12770,392593,491004,406454,237959,77490,230672,373896,116477,151771,237651,438656,262053,65698,48371,470486,351651,272780,98366,163306,173642,460029,569271,540079,407494,58223,125666,97813,459136,84444,508623,155126,118334,55981,405244,95482,429905,74486,176745,451369,137204,442573,270349,503509,561259,409143,266100,106512,144392,536407,169332,131006,481273,212782,1344,369095,265093,285160,209022,562116,469324,118334,411736,112248,187712,339891,456841,193694,532341,98577,520752,109872,233781,106236,372844,311939,414656,564493,494292,528666,48798,53781,442845,459136,352884,287570,195300,412225,403533,548017,294065,230348,366125,103284,398022,57293,267232,147776,76490,59248,543568,98018,108143,462794,62785,4830,396245,343683,333253,578423,531269,136958,460029,563733,107001,510813,227611,483855,418622,61761,80592,376442,290127,422014,406788,538687,543047,217642,134846,566203,58223,394858,41044,154226,322559,56498,315242,155759,99631,443175,329367,406507,277787,75683,36410,88744,405896,93816,549165,331757,919,83203,369095,18073,290186,55523,265093,246576,557053,344630,284909,332103,70555,301515,87395,244126,254154,107469,227236,402137,183385,445324,356862,134636,373194,490321,513752,136958,519186,507333,77490,13249,333253,186471,182642,403464,91782,253861,228772,186471,26787,224203,203930,178274,42092,486087,489704,561578,519276,483363,109354,334865,556404,73858,168878,508862,9949,165341,534885,393120,215694,261815,518007,1344,403955,21609,260073,499022,61080,475280,312631,178274,434278,65698,520752,392609,455144,217072,388429,235794,54316,419360,458721,411620,370978,133564,354694,554116,173642,393631,18073,331885,177651,222694,70766,39512,6146,72601,53525,254749,221809,282770,372390,535613,345408,308421,268360,295618,490321,571671,84758,47912,217072,180446,443459,111406,166031,515056,372157,281886,98016,521138,82658,104647,299201,10872,125242,108088,561261,275131,402374,244126,573675,487017,240770,266100,381763,395174,372844,167430,306105,66604,196932,7120,524650,270349,372378,289690,435887,531269,39512,461064,200038,314147,393120,524433,310719,633,135620,9715,75094,203645,303384,462173,244982,203851,566929,537108,58176,279446,381763,331757,99673,217642,406507,519186,561908,537108,227611,193153,76889,144392,403386,110264,567201,301126,484099,412922,480293,387225,255283,107354,299840,486048,320133,297412,135714,305788,560711,59996,110264,193153,536407,373711,276214,296872,397038,334155,393873,5618,394858,195300,401888,259460,431306,483855,109187,461064,489322,480083,301515,372466,53781,522128,47535,101956,177218,21519,556702,442573,34572,383333,390086,209546,505517,271294,156736,331374,567201,72237,223234,338364,485329,26787,107001,168878,2441,543568,77113,100077,299074,301126,172126,519112,215669,320066,146303,393873,355897,21734,120595,500844,443360,159510,433639,49842,163915,297542,572790,34624,118161,59996,331374,410508,378569,461197,335707,264899,209653,55584,299220,56555,513752,134596,169222,368790,393688,454201,203302,562076,318782,330304,555344,196932,559212,184396,320250,271294,427134,118154,164009,49842,176546,403533,436777,343683,285569,410942,543950,242926,420739,482706,240107,548705,552229,183385,188789,306105,400675,365225,438656,33922,282770,500844,230348,199310,55584,109354,6974,216981,318782,564537,9792,70766,98619,24945,401937,310687,299692,560706,342895,261815,256462,104647,292659,560711,42092,396245,577090,373963,554116,155740,171853,266698,402663,98619,262053,238964,162780,213855,167100,244370,146303,259416,498027,418622,116508,110530,107214,182642,475129,64478,193694,445095,378959,233781,400974,76386,119352,546918,330304,549022,313466,555263,194338,147776,67844,445324,263816,209022,24945,258775,119800,528875,110069,157438,252809,296872,153776,134636,483363,164009,307290,335004,462173,98366,112362,550069,180872,541335,519112,449293,575138,237651,380752,386768,73203,119800,41643,443214,156736,522934,534330,229719,383333,99673,190438,192092,455823,98577,203302,410508,506142,83203,153324,16332,67844,556764,9847,315763,58952,147460,434621,537742,388494,98205,80592,285160,218790,390086,561259,393688,365458,201204,176745,264899,393631,549022,294065,300540,576327,519276,305100,285072,339971,545132,9277,454837,61761,323805,369598,358553,383317,236974,315426,446940,505824,17189,26658,272097,562482,540749,215664,524433,163971,494292,156432,412225,196471,116477,105998,98816,546536,395807,372390,503871,44968,355578,297412,442829,444391,469785,285072,331770,383317,184396,143856,433639,230672,366125,492148,66900,111406,314147,451829,76386,23695,13249,223764,296133,8812,255283,360469,323540,362746,433348,176546,331885,163762,386768,77113,38372,548705,356862,578423,507333,180012,31026,337412,392593,216981,84758,47912,335707,151771,348840,109187,315194,279446,482970,446940,562482,578634,416155,482706,130915,283065,98018,269023,271167,499022,919]"), H.str2array3("[521138,98960,339583,576094,475873,238204,119352,55523,10872,546536,59248,561908,427134,540079,190439,365225,311939,92753,203769,388494,200038,169176,579622,108143,69526,532621,26658,320066,209546,299074,48798,570296,256462,143856,76889,429905,299840,315763,378959,569271,321775,566929,47535,411620,9277,313466,45072,410942,260186,515056,348606,353922,409639,346960,428777,187623,187712,229444,305788,573206,306943,430736,262591,218020,176290,8812,194766,9847,392609,486087,98205,524650,395807,57293,252102,218609,370978,15913,190438,323540,223234,269023,378569,362746,161661,573675,114703,218244,295618,456841,490728,428630,468976,262591,315194,419360,450235,118154,130915,490728,110530,502483,229444,175669,571671,23695,163915,44968,275131,203851,356267,511556,189293,392851,417330,398798,324761,338848,255392,234376,414656,486940,468976,196471,241361,458580,154692,511425,367545,201307,400675,299220,441001,241361,218609,161661,373963,310291,120595,212782,502483,268799,155338,194338,518807,505824,467517,139927,299692,372378,75094,563733,446940,429341,372466,107469,152871,434928,21609,542964,212718,406454,246576,228373,412922,527303,538434,177651,189293,576094,323805,112362,120744,209653,408989,66900,486940,9949,276214,338848,179537,100077,107354,297618,382991,549165,461197,102969,545760,86489,80689,344630,215664,532621,302889,534233,289690,340031,541957,388429,447931,558197,302889,223039,78229,155759,224203,234376,487017,334276,267232,199310,510813,62785,169176,310687,93816,450235,526664,348840,139129,409639,526664,285678,127755,544359,259416,537742,247697,48371,337412,241861,139129,344088,314902,38372,281219,527303,556702,82658,470486,34572,165341,255392,151958,509679,53525,123896,537932,367545,177218,340031,290752,482970,532163,61080,213855,403955,26125,296133,70555,297618,133564,505517,483972,4830,240102,550069,347857,272097,532163,242926,120744,369252,192092,72601,128057,143290,538434,151958,345408,443486,405255,135714,123896,392851,449293,17189,373711,402663,579622,564493,206623,179537,277787,176977,428630,462794,481346,272780,546918,491004,355578,577090,522934,253861,78229,566203,489704,114103,117715,106236,384003,102969,262332,491629,201307,395174,9715,518007,399749,399749,383046,252102,95446,155126,9792,153324,397038,65313,194766,523869,336173,537932,2441,21519,72237,355897,250222,223039,320150,541957,218604,87395,228772,518807,364542,402374,266698,171853,442845,290752,409143,332103,66604,408106,535613,214757,483972,31026,152871,15913,254197,238204,270919,402137,334865,251950,54316,498027,405255,509679,103284,344073,64478,480401,433348,383046,374389,315487,516799,306943,314238,274132,122491,285569,331770,73858,324761,463050,290186,443486,508179,260186,154226,401937,215616,153776,104596,244982,342895,62216,21734,475873,534233,400974,435887,180446,548017,251950,352884,458580,519829,108088,491629,541335,236974,368790,398022,84444,249231,134846,365458,160670,354694,467517,312631,95446,508623,458721,405244,408106,114703,315426,351651,270919,157438,481273,156432,489322,322559,552980,573206,127755,218020,305100,155740,41044,443214,314238,368440,58176,249231,201204,254197,218149,557053,165145,106512,254964,438879,443175,560706,262061,218244,437418,489634,45072,579564,240770,558197,122491,116508,16332,297542,166031,114103,169222,152482,559212,240107,252809,369252,534330,580463,356267,282876,215694,334276,339971,47950,545760,268799,62216,320133,232040,254154,223157,307663,508862,419397,180857,447931,284160,128057,131006,212718,499661,484099,228373,260073,214757,561261,455991,55981,282876,562076,471706,203645,47950,434928,180857,472149,190757,387225,190439,372157,411736,320250,175669,176290,347857,80689,189804,506142,433816,176977,428777,451829,218149,7120,380752,463050,262061,56498,339583,156250,203930,514323,443360,511556,281219,398798,511425,532341,98816,441961,544359,329367,6974,503509,303384,287570,321775,159510,155338,417330,218790,455823,578634,475280,543047,118161,555263,12770,76490,434278,105998,248575,461492,283065,258775,556764,244370,564537,73203,376442,223157,445095,86489,160670,230084,336173,338364,471706,162780,154692,103786,406788,446940,489634,519829,535995,125666,368440,218604,88744,542964,98016,49088,422014,444391,171781,574712,374389,112248,408989,300540,508179,156250,88462,460329,516799,443459,545132,259460,455991,307290,187623,117715,125242,346960,143290,171781,95482,562116,492148,65313,36410,101956,172126,535995,165145,284160,576327,221809,97813,167100,401888,223764,556404,163762,88462,538687,333887,107214,248575,299201,455144,215616,460329,99631,180872,241861,262332,360469,454837,163306,26125,229719,420739,344088,222694,235794,373194,339891,382991,147460,472149,522128,430736,284909,570296,308421,227236,419397,315487,481346,528666,434621,134596,314902,429341,443693,344073,250222,575138,232040,485329,240102,528875,254964,169332,46091,451369,373896,416155,348606,442829,405896,514323,437418,543950,436777,75683,574712,78897,46091,230084,454201,137204,334155,304071,33922,552980,285678,103786,461492,268360,292659,78897,333887,353922,561578,92753,49266,540749,431306,139927,572790,534885,320150,503871,441001,529503,281886,6146,580463,384003,369598,633,188789,190757,290127,167430,41643,555344,441961,109872,486048,475129,304071]")));
	}

	public void debug3(Solution4 so) {
//		H.compare(so, so);
	}

	public void debug2(Solution4 so) {
//		H.compare(so, so);
	}

	public void debug1(Solution4 so) {
//		H.compare(so, so);
	}

	public static void main(String[] args) {
		Solution4Test test = new Solution4Test();
		Solution4 so = new Solution4();
		test.debug1(so);
		test.debug2(so);
		test.debug3(so);
		test.debug4(so);
	}

}
